package com.qifenqian.turbot.module.contract

import com.qifenqian.turbot.module.entity.request.CategoryRequest
import com.qifenqian.turbot.module.entity.request.DishAddEditRequest
import com.qifenqian.turbot.module.entity.response.UploadEntity
import com.qifenqian.turbot.module.entity.response.dish.CategoryEntity
import com.qifenqian.turbot.module.entity.response.dish.DishEntity
import com.qifenqian.turbot.net.ModelCallback

/**
 * @author H
 * @createTime 2018/12/27 14:25
 * @description
 * @see
 * @since
 */
interface DishContract {

    interface Model {
        /**
         * 获取所有菜类
         */
        fun getCategoryList(callback: ModelCallback<List<CategoryEntity>>)
//
//        /**
//         * 获取所有菜品
//         */
//        fun getAllDishList(callback: ModelCallback<List<DishEntity>>)

        /**
         * 同时获取所有菜类与所有菜品,两个接口合并
         */
        fun getDishAndCategoryList(callback: ModelCallback<Any>)

        /**
         * 添加菜品类型
         */
        fun addCategory(dishTypeName: String, callback: ModelCallback<CategoryEntity>)

        /**
         * 添加菜品
         */
        fun addDish(request: DishAddEditRequest, callback: ModelCallback<DishEntity>)

        /**
         * 2019/1/2 13:52
         * 编辑菜品
         */
        fun editDish(request: DishAddEditRequest, callback: ModelCallback<Nothing>)

        /**
         * 2019/1/2 13:52
         * 删除辑菜品
         */
        fun deleteDish(dishId: Int, callback: ModelCallback<Nothing>)

        /**
         * 编辑菜品类型
         */
        fun editCategory(dishName: String, dishTypeId: Int, callback: ModelCallback<Nothing>)

        /**
         * 删除菜品类型
         */
        fun deleteCategory(dishTypeId: Int, callback: ModelCallback<Nothing>)

        /**
         * 保存菜品类型
         */
        fun saveCategory(request: CategoryRequest, callback: ModelCallback<Nothing>)

        /**
         * 上传菜品图片
         */
        fun uploadFile(filePath: String, callback: ModelCallback<UploadEntity>)

    }

    interface View {
        fun getCategoryListResult(isSuccess: Boolean, code: Int = 0, msg: String? = null, categoryEntities: List<CategoryEntity>? = null) {}

//        fun getAllDishListResult(isSuccess: Boolean, code: Int = 0, msg: String? = null, dishEntities: List<DishEntity>? = null) {}
        fun getDishAndCategoryListResult(isSuccess: Boolean, code: Int = 0, msg: String? = null, categoryEntities: List<CategoryEntity>? = null, dishEntities: List<DishEntity>? = null) {}

        fun addCategoryResult(isSuccess: Boolean, code: Int = 0, msg: String? = null, categoryEntity: CategoryEntity? = null) {}

        fun addDishResult(isSuccess: Boolean, code: Int = 0, msg: String? = null, dishEntity: DishEntity? = null) {}

        fun editDishResult(isSuccess: Boolean, code: Int = 0, msg: String? = null) {}

        fun deleteDishResult(isSuccess: Boolean, code: Int = 0, msg: String? = null) {}

        fun editCategoryResult(isSuccess: Boolean, code: Int = 0, msg: String? = null, position: Int = -1, newCategory: String? = null) {}

        fun deleteCategoryResult(isSuccess: Boolean, code: Int = 0, msg: String? = null, position: Int = -1) {}

        fun saveCategoryResult(isSuccess: Boolean, code: Int = 0, msg: String? = null) {}

        fun uploadFileResult(isSuccess: Boolean, code: Int = 0, msg: String? = null, uploadEntity: UploadEntity? = null) {}
    }

    interface Presenter {
        fun getCategoryList()
//
//        fun getAllDishList()

        fun getDishAndCategoryList()

        fun addCategory(dishTypeName: String)

        fun addDish(request: DishAddEditRequest)

        fun editDish(request: DishAddEditRequest)

        fun deleteDish(dishId: Int)

        fun editCategory(categoryName: String, dishTypeId: Int, position: Int = -1)

        fun deleteCategory(dishTypeId: Int, position: Int)

        fun saveCategory(request: CategoryRequest)

        fun uploadFile(filePath: String)
    }
}
